Revision: libselinux--tls-fix--1.30--patch-1
Archive: srivasta@debian.org--etch
Creator: Manoj Srivastava <srivasta@debian.org>
Date: Wed Sep  6 22:43:10 CDT 2006
Standard-date: 2006-09-07 03:43:10 GMT
Modified-files: src/matchpathcon.c
New-patches: srivasta@debian.org--etch/libselinux--tls-fix--1.30--patch-1
Summary: remove need for thread local storage
Keywords: 


On a number of architectures, glibc 2.4 is not yet stable enough for use
(this is the case on mipsel, mips, arm, m68k and hppa). This means that
thread local storage is not available on these architectures. A recent
change in matchpathcon.c made a static file scoped variable (myflags)
thread local -- the reason being, that the file local variable was
temporarily modified by a couple of calls, and then reset back; and if
any other threads used these variables, or worse, cached a local copy
[which would save the modified version], modified it temporarily, and
restored the cached version, the value would be corrupted.

Simply changing the signatures of the calls to pass the variable along,
instead of using the file scoped variable, was not viable, since this
would change the API and thus the soname of the library.

The solution in this patch is to keep the function calls as wreappers,
and create _real versions of all functions that explicitly pass around
the flag variable. All functions call the _real versions of the internal
functions in the function body.  This makes the myflags variable thread
safe again.
